<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>档案管理--首页</title>
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/d3.v3.min.js"></script>
<link href="libs/nv.d3.min.css" rel="stylesheet">
<script src="libs/nv.d3.min.js"></script>
<script src="libs/js.cookie-2.1.0.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>档案管理</strong>
				</h2>
			</div>


			<div class="pull-right" className="input-group">
				<input className="form-control" type="text" id="a"
					placeholder="档案号或身份证号" />
				<!--搜索框-->
				<span className="input-group-btn">
					<button className="btn btn-default" onclick={this.submit}
						type="button" id="cha">
						<i className="fa fa-search">搜索</i>
					</button>
				</span>
			</div>
		</div>
		<div class="container">
			<div class="row">

				<div class="col-md-12">
					<ul class="nav nav-pills">
						<li class="active"><a href="index.html">首页</a></li>
						<li><a href="in.html">档案录入</a></li>
						<li><a href="query.html"> 查询</a></li>
						<li><a href="tongji.html"> 统计</a></li>
						<li><a href="more.html"> 档案上传</a></li>
						<li><a href="#">用户：<span id="text3"></span></a></li>
						<li><a id="exit"> 退出</a></li>

					</ul>
					<div class="col-xs-3"></div>

				</div>
			</div>
		</div>
		<div class="container">
			<div class="row">
				<div class="col-md-12">
					<hr />
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-8">
				<div class="panel panel-primary">
					<div class="panel-heading">查询记录</div>
					<div class="panel-body" id="list1"></div>

				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-8">
				<div class="panel panel-primary">
					<div class="panel-heading">添加记录</div>
					<div class="panel-body" id="list2"></div>

				</div>
			</div>
		</div>
		<script id="template" type="text/x-handlebars-template">
{{#each item}}
<div class="panel panel-default col-md-3">
  <div class="panel-body">
   <dl>
    <dt>查询日期</dt> <dd>{{date}}</dd>
     <dt>查询时间</dt> <dd>{{time}}</dd>
     <dt>档案号</dt> <dd>{{archive_id}}</dd>
     <dt>身份证号</dt> <dd>{{identity}}</dd>
    <dt>姓名</dt> <dd>{{name}}</dd>
    
    
    <a href="more.html?id={{id}}">详情</a>
   </dl>
 </div>
</div>
{{/each}}
</script>
		<script id="template2" type="text/x-handlebars-template">
{{#each item}}
<div class="panel panel-default col-md-3">
  <div class="panel-body">
   <dl>
    <dt>添加日期</dt> <dd>{{date}}</dd>
     <dt>添加时间</dt> <dd>{{time}}</dd>
     <dt>档案号</dt> <dd>{{archive_id}}</dd>
     <dt>身份证号</dt> <dd>{{identity}}</dd>
    <dt>姓名</dt> <dd>{{name}}</dd>
    
    
    <a href="more.html?id={{id}}">详情</a>
   </dl>
 </div>
</div>
{{/each}}
</script>
		<script type="text/javascript">
			$(function() {

				$('#exit').click(function() {
					$.post('exit.action', {

					}, function(res, status) {
						if ('OK' == res) {
							alert('退出成功');
							window.location.href = 'login.html';
						} else if ('ERR' == res) {
							alert('账号或密码错误');
						}
					});
				});

				$('#cha').click(function() {
					$.post('chaxun2.action', {
						a : $('#a').val()
					}, function(res, status) {
						console.log(a);
						if ('ERR1' == res) {
							alert('未查到档案');
						} else if ('ERR' == res) {
							alert('未定位到准确档案');
						} else {
							window.location.href = 'more.html?id=' + res;
						}
						;
					});
				});

				$.getJSON('user.action', function(res) {
					console.log(res);
					$('#text3').text(res.nickname);
				});

				$.getJSON('record.action', function(res) {
					//console.log(res); 
					var data = {
						'item' : res
					};
					var t = Handlebars.compile($('#template').html());
					$('#list1').html(t(data));
				});
				$.getJSON('tianjia.action', function(res) {
					//console.log(res); 
					var data = {
						'item' : res
					};
					var t = Handlebars.compile($('#template2').html());
					$('#list2').html(t(data));
				});
			});
		</script>
		<script type="text/javascript">
			if (!Cookies.get("user")) {
				window.location.href = 'login.html';
			}
		</script>
		<script type="text/javascript">
			$(function() {
				$.backstretch("456.jpg");
			});
		</script>
</body>
</html>